<template>
  <div>
    <van-submit-bar
      :price="togglePrcie * 100"
      button-text="支付"
      @submit="onSubmit"
    />
  </div>
</template>

<script>
import { Dialog } from "vant";
import { Toast } from "vant";
export default {
  props: ["togglePrcie", "list"],
  data() {
    return {
      paying: false,
    };
  },
  methods: {
    onSubmit() {
      if (this.list[0].name == null) {
        Toast("请选择收货地址");
      } else {
        Dialog.confirm({
          title: "确认支付",
          message: "是否支付",
        })
          .then(() => {
            // on confirm
            console.log(111);
            this.$emit("goodsPayState", 1);
            this.$router.push({ path: "/pay" });
          })
          .catch(() => {
            // on cancel
            console.log(222);
            this.$emit("goodsPayState", 0);
            this.$router.push({ path: "/pay" });
          });
      }
    },
  },
};
</script>

<style lang="less" scoped>
</style>